import { createRouter, createWebHistory } from 'vue-router';

// 引入组件
import index from '../page/Index.vue';
import login from '../page/Login.vue';
import page1 from '@/components/mainbody/page1.vue';
import page2 from '@/components/mainbody/page2.vue';
import page5 from '@/components/mainbody/page5.vue';
import page6 from '@/components/mainbody/page6.vue';
// 定义路由
const routes = [
    {
        path: '/',
        component: login,
        // 隐藏这个菜单
        hidden: true,
        meta: {
            name: '登录'
        }
    },
    {
        path: '/index',
        component: index,
        // 隐藏这个菜单
        hidden: true,
        meta: {
            name: '主页'
        }
    },
    {
        meta: {
            name: '页面3'
        },
        children: [
            {
                path: '/page1',
                component: page1,
                meta: {
                    name: '页面1'
                }
            },
            {
                path: '/page2',
                component: page2,
                meta: {
                    name: '页面2'
                }
            },
        ]
    },
    {
        meta: {
            name: '页面4'
        },
        children: [
            {
                path: '/page5',
                component: page5,
                meta: {
                    name: '页面5'
                }
            },
            {
                path: '/page6',
                component: page6,
                meta: {
                    name: '页面6'
                }
            },
        ]
    },
];

// 创建router实例
const router = createRouter({
    history: createWebHistory(),
    routes,
});

export default router;